A dynamic run-time environment for a language such as JAVA™ is responsible for managing memory used during execution of a program to store information. References are used by a run-time environment to identify and ultimately access regions of memory. For main memory in the address space of an executing program, these references are typically encoded using machine pointers. Since machine pointers are closely coupled to the underlying hardware and firmware of a computer system, machine pointers provide a fast means of accessing files and, hence, are a popular implementation for references. However, security may be jeopardized by exposing actual machine addresses of local data areas to the dynamic run-time environment for a language such as JAVA.
Many platforms have system library support for memory-mapped I/O, such as the UNIX function map( ), which establishes a mapping between the address space of a process and information stored in a file outside of the address space of the process (e.g. on disk or in another kind of secondary storage device). Successful use of the map( ) function provides an pointer containing a memory address to a region of main memory that corresponds to the mapped portion of the file. Memory-mapped I/O allows access to resources via address space manipulations, instead of through read and write operations, which reduces the processing time overhead compared to read and write access to a file. For example, a file on disk can be manipulated by memory mapping the file into virtual memory, modifying data in the region of the address space that has been mapped for the file via machine pointers, and storing the modified data back into secondary storage.
Differences between server environments make machine independence very difficult to achieve for portable run-time environments. For example, some operating systems, in practice if not by design, limit the guaranteed size of contiguous main memory to a “page,” typically about two or four kilobytes in size, and prior paged memory systems simply failed when sufficient large blocks of virtual memory were not available. This page-size limitation may occur, for example, on computer systems that permit shared memory for access by different processes and even by different processors.
Another problem is that for safety reasons, some run-time environments do not permit applications to manipulated raw pointers directly. One example is a run-time environment for implementing JAVA™, an platform-independent, object-oriented language originally developed by Sun Microsystems, Inc. In JAVA, attributes and methods for a class of objects are typically defined in a source file, which is compiled into an architecture-neutral object file containing bytecodes that are interpreted in a virtual machine at the target platform. Because Java does not allow direct manipulation of memory for safety reasons, memory manipulations go through a call interface that dispatches to system native methods to perform the actual manipulation of main memory.
Therefore, a need exists for an efficient and safe memory-mapped I/O support for paged memory architectures.